/*
 ------------------------------------------------------------------------------
 Copyright (C) 2006-2007 Team Blur.

 This file is part of the Quantum Engine source code.

 The Quantum Engine source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quantum Engine source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quantum Engine source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


#ifndef __SYSTEM_H__
#define __SYSTEM_H__


// Shows or hides the dedicated console
void			Sys_ShowConsole (bool show);

// Returns a list of files and subdirectories that match the given extension
// (which must include a leading '.' and must not contain wildcards).
// If extension is NULL, all the files will be returned and all the
// subdirectories ignored.
// If extension is "/", all the subdirectories will be returned and all the
// files ignored.
// The returned list can optionally be sorted.
const char **	Sys_ListFiles (const char *directory, const char *extension, bool sort, int *numFiles);

// Returns a list of files and subdirectories that match the given filter.
// The returned list can optionally be sorted.
const char **	Sys_ListFilteredFiles (const char *directory, const char *filter, bool sort, int *numFiles);

// Frees the memory allocated by Sys_ListFiles and Sys_ListFilteredFiles
void			Sys_FreeFileList (const char **fileList);

// Creates the given directory, if it doesn't exist
void			Sys_CreateDirectory (const char *directory);

// Returns the default base directory
const char *	Sys_DefaultBaseDirectory (void);

// Returns the default save directory
const char *	Sys_DefaultSaveDirectory (void);

// Loads the given library from the current game directory. Appends suffix and
// extension appropriate for the underlying platform.
// Returns NULL if not found.
void *			Sys_LoadLibrary (const char *name);

// Frees the given library
void			Sys_FreeLibrary (void *libHandle);

// Gets the address of the given procedure from the given library
void *			Sys_GetProcAddress (void *libHandle, const char *procName);

// Prints text to the dedicated console and possibly other output windows (like
// debugger output)
void			Sys_Print (const char *text);

// Shuts down all the subsystems, shows the given error message, then waits for
// the user to quit.
// Used by Com_Error for fatal errors.
void			Sys_Error (const char *fmt, ...);

// Generates events like user input and other system specific events.
// Returns the current time in milliseconds.
int				Sys_GenerateEvents (void);

// Gets text from the clipboard, if available
const char *	Sys_GetClipboardText (void);

// Opens the given URL and optionally quits the program
void			Sys_OpenURL (const char *url, bool quit);

// Yields CPU time for the given number of milliseconds
void			Sys_Sleep (int msec);

// Sys_Milliseconds should only be used for profiling purposes, any game
// related timing information should come from event timestamps
int				Sys_Milliseconds (void);

// For accurate performance testing
double			Sys_GetClockTicks (void);
double			Sys_ClockTicksPerSecond (void);

// Returns information about the CPU
int				Sys_GetProcessorId (void);
const char *	Sys_GetProcessorString (void);

// Initializes system specific stuff
void			Sys_Init (void);

// Shuts down system specific stuff
void			Sys_Shutdown (void);

// Shuts down all the subsystems and quits the program completely
void			Sys_Quit (void);


#endif	// __SYSTEM_H__
